Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install clang-19 and clang-14 on cpubuilder, enabling ASan builds. #6

Merged
merged 2 commits into from
Aug 29, 2024

Conversation

ScottTodd
Copy link
Member

Tested with the build_tools/cmake/build_and_test_asan.sh script from IREE. When I tried to build with ASan on clang-14, I got segfaults in llvm-tblgen and other tools. Not sure if that could be made to work, but rolling forward to a newer compiler seems fine for a sanitizer build.

In the IREE repo, we had a split between base and base-bleeding-edge dockerfiles. Here, I'm just installing multiple compilers and letting the job choose between them (as on GitHub-managed runners). The binary size increase is fairly minor in the grand scheme of things.

The diff to use this from IREE will look like this, at least for ASan (still working on TSan):

~/dev/projects/iree (users/scotttodd/ci_linux_x64_clang)$ git diff
diff --git a/.github/workflows/ci_linux_x64_clang_asan.yml b/.github/workflows/ci_linux_x64_clang_asan.yml
index d3d291af98..9274e84d67 100644
--- a/.github/workflows/ci_linux_x64_clang_asan.yml
+++ b/.github/workflows/ci_linux_x64_clang_asan.yml
@@ -34,21 +34,21 @@ jobs:
       - environment=${{ needs.setup.outputs.runner-env }}
       - cpu
       - os-family=Linux
+    container: ghcr.io/iree-org/cpubuilder_ubuntu_jammy_x86_64@sha256:latest
+    defaults:
+      run:
+        shell: bash
     steps:
       - name: "Checking out repository"
         uses: actions/checkout@v4.1.7
         with:
           submodules: true
-      - name: "Building and testing with ASan"
+      - name: Install Python requirements
+        run: python3 -m pip install -r ./runtime/bindings/python/iree/runtime/build_requirements.txt
+      # TODO(#18238): add local or remote ccache
+      - name: Build and test with ASan
         env:
-          IREE_WRITE_REMOTE_CCACHE: ${{ needs.setup.outputs.write-caches }}
-        run: |
-          # Note that this uses the latest version of the clang compiler, etc.
-          # This gives us access to the latest features and validates that IREE
-          # builds using the latest versions.
-          ./build_tools/github_actions/docker_run.sh \
-            --env "IREE_CCACHE_GCP_TOKEN=$(gcloud auth application-default print-access-token)" \
-            --env "IREE_WRITE_REMOTE_CCACHE=${IREE_WRITE_REMOTE_CCACHE}" \
-            --env "CCACHE_NAMESPACE=base-bleeding-edge@sha256:14200dacca3a0f3a66f8aa87c6f64729b83a2eeb403b689c24204074ad157418" \
-            gcr.io/iree-oss/base-bleeding-edge@sha256:cf2e78194e64fd0166f4141317366261d7a62432b72e9a324cb8c2ff4e1a515a \
-            ./build_tools/cmake/build_and_test_asan.sh
+          # The default compiler in this container (clang-14) is too old for ASan.
+          CC: clang-19
+          CXX: clang++-19
+        run: ./build_tools/cmake/build_and_test_asan.sh

@ScottTodd ScottTodd requested a review from marbre August 28, 2024 21:28
@ScottTodd
Copy link
Member Author

Ah, got TSan working with this dockerfile too. Needed some patches to the scripts and workflow file: iree-org/iree#18396

Copy link
Member

@marbre marbre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me :)

@ScottTodd ScottTodd merged commit 0f46bb8 into iree-org:main Aug 29, 2024
1 check passed
@ScottTodd ScottTodd deleted the asan-deps branch August 29, 2024 18:18
ScottTodd added a commit to iree-org/iree that referenced this pull request Sep 3, 2024
Following iree-org/base-docker-images#6, the new
cpubuilder dockerfile should have all the software needed for ASan and
TSan building + testing (specifically `clang-19` instead of just
`clang-14`).

Progress on #15332. The only
remaining uses of `gcr.io/iree-oss/base.*` are:

* `build_test_all_bazel` uses `gcr.io/iree-oss/base-bleeding-edge`
* `publish_website` uses `gcr.io/iree-oss/base`
* arm64 workflows use `gcr.io/iree-oss/base-arm64`
* `gcr.io/iree-oss/emscripten` (used by web test workflows) depends on
`gcr.io/iree-oss/base`
saienduri pushed a commit to iree-org/iree that referenced this pull request Sep 12, 2024
Following iree-org/base-docker-images#6, the new
cpubuilder dockerfile should have all the software needed for ASan and
TSan building + testing (specifically `clang-19` instead of just
`clang-14`).

Progress on #15332. The only
remaining uses of `gcr.io/iree-oss/base.*` are:

* `build_test_all_bazel` uses `gcr.io/iree-oss/base-bleeding-edge`
* `publish_website` uses `gcr.io/iree-oss/base`
* arm64 workflows use `gcr.io/iree-oss/base-arm64`
* `gcr.io/iree-oss/emscripten` (used by web test workflows) depends on
`gcr.io/iree-oss/base`
saienduri pushed a commit to iree-org/iree that referenced this pull request Sep 12, 2024
Following iree-org/base-docker-images#6, the new
cpubuilder dockerfile should have all the software needed for ASan and
TSan building + testing (specifically `clang-19` instead of just
`clang-14`).

Progress on #15332. The only
remaining uses of `gcr.io/iree-oss/base.*` are:

* `build_test_all_bazel` uses `gcr.io/iree-oss/base-bleeding-edge`
* `publish_website` uses `gcr.io/iree-oss/base`
* arm64 workflows use `gcr.io/iree-oss/base-arm64`
* `gcr.io/iree-oss/emscripten` (used by web test workflows) depends on
`gcr.io/iree-oss/base`

Signed-off-by: saienduri <saimanas.enduri@amd.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants